<?php
session_start();
include_once('server/config.php');
include_once('server/cmdVarControl.php');
include_once('server/emailer.php');
include_once('server/sqlControl.php');
include_once('server/specialFields.php');
include_once('server/sqlControlPlus.php');
if (CM_LOGINTABLE != 'none')
{
	include_once('server/userControl.php');
	include_once('3rdPartyPHP/loginTickets.php');
	include_once('3rdPartyPHP/subnavCategories.php');
	include_once('server/adminControl.php');
	include_once('server/cms.php');

	if (get('log') == 'create')
	{
		createNewAccount(post('fname'), post('lname'), post('userName'), post('password'), post('email'));
	}
	else if (get('log') == 'in')
	{
		adminlog('in');
	}
	else if (get('log') == 'out')
	{
		adminlog('out');
	}
	$adminLinks = adminContent('
	<div id="adminContainer">
		<div id="adminLinks">
			<li><a href="'.INDEX.'admin">Administration Page</a></li><li><a href="'.INDEX.'orderList">Active Orders</a></li><li><a href="'.INDEX.'orderList'.EXT.'archive=yes">Inactive Orders</a></li><li><a href="'.INDEX.'home'.EXT.'log=out">LogOut</a></li>
		</div>
	</div>
	', '');
}
else
{
	$adminLinks = '';
}
	
	
include_once('server/htmlPreProc.php');

//VARS
$navigation = NAVIGATOR;

$navigationText = navigation(explode("\n", $navigation));
if (get('page') == 'null')
{
	echo redirectSiteNow(INDEX.'home');
}

$page = loadPage(explode("\n", $navigation));    
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Sole Service Manila</title>
		
		<link href="globalStyles.php?page=<?php echo get('page');?>" media="screen" type="text/css" rel="stylesheet" />
		<!--[if gt IE 6]> <link href="css/ie7global.css" rel="stylesheet" type="text/css"> <![endif]-->
		
		<script src="js/mootools/core.js" language="javascript"></script>
		<script src="js/mootools/more.js" language="javascript"></script>
		<script src="js/lightbox/slimbox.js" language="javascript"></script>
		<script src="js/tinymce/jscripts/tiny_mce/tiny_mce.js" language="javascript"></script>
		<script src="js/cm/core.js" language="javascript"></script>
		<script src="js/cm/tinymce.js" language="javascript"></script>
		<script src="js/mootools/scroll.js" language="javascript"></script>
		<link rel="shortcut icon" href="./favicon.gif" type="image/x-icon" />
		<?php include_once('dynCSS/global.php'); 
		$navAr = explode("\n", $navigation);
		$exist = 'no';
		for ($i=0; $i<sizeOf($navAr); $i++)
		{
			$data = explode("|", $navAr[$i]);
			if ($data[0] == get('page') && get('page') != 'null')
			{
				
				$exist = 'yes';
			}
			if(get('page') == 'admin')
			{
				$exist = 'yes';
			}
		}
		if($exist == 'yes')
		{
			include_once('dynCSS/'.get('page').'.php');
		}
		?>
		
	</head>
	<body>
		<?php echo (get('log') == 'in' ? redirectSiteNow(INDEX.'admin') : '');?>
		<?php echo $adminLinks;?>
		<?php 
		$noItems = getCartItems();
		echo '
		<div class="container_12">
			<div class="grid_12 relative">
				<div id="searchBox">
						'.adminContent('<a href="#" class="myBag">Manage Products</a>', (get('page') == 'cart' ? '' : '<a href="'.INDEX.'cart" class="myBag">My Bag ('.$noItems.' items )</a>')).'<br />
						<input type="text" id="searchBar" name="searchTerm"/><input type="button" id="searchSub" alt="'.INDEX.'catalogue'.EXT.'category=search&gallery=all&searchString="/>
		</div>
			</div>
		</div>
		';?>
		<div id="header" class="container_16">
			<?php
				
				
				echo '
				<div class="grid_6 navPadding">
					
					<div class="navLinkDiv" style="width: 127px; height: 19px; margin-right: 22px;"><a href="'.INDEX.'catalogue'.EXT.'category=accessories&gallery=main" class="navigationLink">Accessories</a>
					<div class="subnavigation">
						<div class="subNavBGSemi">
							'.getSubNavs('accessories', 'main').'
						</div>
					</div>
					</div>
					
					<div class="navLinkDiv" style="width: 110px; height: 23px;"><a href="'.INDEX.'catalogue'.EXT.'category=women&gallery=main" class="navigationLink">Women</a>
					<div class="subnavigation">
						<div class="subNavBGSemi">
							'.getSubNavs('women', 'main').'
						</div>
					</div>
					</div>
					
					
					<div class="navLinkDiv" style="width: 71px; height: 23px;"><a href="'.INDEX.'catalogue'.EXT.'category=men&gallery=main" class="navigationLink">Men</a>
					<div class="subnavigation">
						<div class="subNavBGSemi">
							'.getSubNavs('men', 'main').'
						</div>
					</div>
					</div>
					
				</div>
				<div id="bigLogo" class="grid_4">
					<h1>Sole Service Manila</h1>
					<a href="'.INDEX.'home'.'" id="mainLogo" title="Sole Service Manila"><img src="img/logo.png" alt="logo" width="207" height="100"/></a>
				</div>
				
				<div class="grid_6 navPadding">
					
					<div class="navLinkDiv" style="width: 100px; height: 23px;"><a href="'.INDEX.'catalogue'.EXT.'category=sale" class="navigationLink">Sale</a>
					</div>
					
					<div class="navLinkDiv" style="width: 130px; height: 23px;"><a href="'.INDEX.'lookbook'.EXT.'category=women&gallery=main" class="navigationLink">Lookbook</a>
					</div>
					
					<div class="navLinkDiv" style="width: 100px; height: 23px;"><a href="#" class="navigationLink">Media</a>
					<div class="subnavigation">
						<div class="subNavBGSemi">
							<a href="#" class="subnavLink">Blog</a>
							<a href="#" class="subnavLink last">Press</a>
						</div>
					</div>
					</div>
				</div>
				';
			?>
		</div>
		<div class="clear">
		<!--spanner-->
		</div>
		<div id="pageContent" class="<?php echo (get('page') == 'null' || get('page') == 'home' || get('page')== 'cart'? '' : 'container_12');?>">
			<?php echo $page;?>
		</div>
		<div class="clear">
		<!--spanner-->
		</div>
		<div id="<?php echo (get('page') == 'null' || get('page') == 'home' ? 'footerFix' : 'footer');?>">
			<div id="footDiv" class="centerAlign">
				<div id="subscribe">Subscribe <form id="subForm" method="POST" action="<?php echo INDEX.'0269458670'?>"><input type="hidden" name="6752491208567" value="921084670968345"/><input type="text" name="subscribe" id="subText"/><input type="submit" style="display: none;"/></form>&nbsp;&nbsp;
				<a href="<?php echo INDEX.'about';?>" class="downNav">About</a> | <a href="<?php echo INDEX.'guide'?>" class="downNav">Size Guide</a> | <a href="<?php echo INDEX.'shipping';?>" class="downNav">Shipping</a> | <a href="<?php echo INDEX.'terms';?>" class="downNav">Terms &amp; Conditions</a> | <a href="<?php echo INDEX.'contact';?>" class="downNav">Contact Us</a><div id="tooltipSubs"></div>
				<br /><div id="copyright">&copy;2011 Sole Service Manila. All Rights Reserved. Powered by <?php echo logo();?></div>
				</div>
			</div>
		</div>
	</body>
</html>
